package rigby.projects.wikipediawebcrawler;

import java.util.Scanner;

public class WebCrawlerMenus {
	
	Scanner userInput = new Scanner(System.in);
	ConsoleInput ci = new ConsoleInput();
	WebCrawler wc = new WebCrawler();
	WebCrawlerDataMethods randomLinkGetter = new WebCrawlerDataMethods();
	
	public void mainMenu(){
		System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
		System.out.println("Welcome to Will's Wikipedia Crawler");
		System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
		System.out.println();
		
		System.out.println("Press (1) to begin a random crawl");
		System.out.println();
		System.out.println("Press (2) to begin a user-initiated crawl");
		System.out.println();
		System.out.println("Press (3) to view information about this program");
		System.out.println();
		System.out.println("-------------------------------------");
		int userSelection = ci.getValidMenuSelection("Enter your choice here: ", "-------------------------------------", 1, 3);
		
		switch(userSelection){
		case 1:
			randomCrawlMenu();
			break;
			
		case 2:
			
			break;
			
		case 3:
			
			break;
			
		default:
			
		}
	}
	
	public void randomCrawlMenu(){
		System.out.println();
		System.out.println("You have chosen to begin a randomized crawl");
		System.out.println();
		System.out.println("Press (1) to begin");
		System.out.println();
		System.out.println("Press (2) to return to the main menu");
		System.out.println();
		System.out.println("-------------------------------------");
		int userSelection = ci.getValidMenuSelection("Enter your choice here: ", "-------------------------------------", 1, 3);
		
		switch(userSelection){
		case 1:
			System.out.println();
			System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			System.out.println("          Beginning Crawl...        ");
			System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
			System.out.println();
			wc.crawlUrl(randomLinkGetter.getRandomLink());
			break;
			
		case 2:
			System.out.println();
			mainMenu();
			break;
			
		default:
			
		}
	}

}
